<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ReadString</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">ReadString()</font></b></p>
<p><b>语法</b></p><blockquote>

Text$ = <font color="#3A3966"><b>ReadString</b></font>(#File [, Flags [, Length]])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Read a string from a file until an 'End Of Line' character is found (Unix, DOS and Macintosh 
file formats are supported). 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#File</i></td>
<td width="90%"> 
 
The file to read from. 

 

</td></tr>
<tr><td><i>Flags (可选)</i></td>
<td> 
 
The flags to apply while reading the string. It may be one of the following values: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Ascii</font>  : reads the string as ASCII, even when the program is compiled in unicode mode
  <font color="#924B72">#PB_UTF8</font>   : reads the string as UTF8, even when the program is compiled in ASCII mode
  <font color="#924B72">#PB_Unicode</font>: reads the string as UTF16 (the program may be either in unicode or ASCII mode).
</font></pre>

combined with: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_File_IgnoreEOL</font>: ignores the end of line (but the resulting string will still contain them) until the specified
                      length or the end of file.
</font></pre>

If this parameter is not specified, the string is 
read as UTF8 if the program is compiled in <a href="../reference/unicode.html">unicode</a> mode, else it is read 
as ASCII. 

 

</td></tr>
<tr><td><i>Length (optional)</i></td>
<td> 
 
Read the file until the length (in characters) have been reached. If an end of line is encountered 
before the length is reached, the read will stop (unless the flag <font color="#924B72">#PB_File_IgnoreEOL</font> has been set). 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns the read string, or an empty string if the read has failed. 

 

</blockquote><p><b>备注</b></p><blockquote>



For detecting the string encoding format (byte order mark) used in a file there is the 
<a href="readstringformat.html">ReadStringFormat()</a> function available. 
<br>
<br>
For an example see the <a href="readfile.html">ReadFile()</a>. 

 

</blockquote><p><b>参阅</b></p><blockquote>

<a href="writestring.html">WriteString()</a>, <a href="readstringformat.html">ReadStringFormat()</a>, <a href="openfile.html">OpenFile()</a>, <a href="readfile.html">ReadFile()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=readquad.html>ReadQuad()</a> - <a href="index.html">File Index</a> - <a href="readstringformat.html">ReadStringFormat()</a> -&gt;<br><br>

</body></html>